import requset from "@/utils/request";
import qs from "qs";

enum URL {
  SystemRole = '/v1/admin/system/role/index',
  SysFindRole = '/v1/admin/system/role/find',
  SysAddRole = '/v1/admin/system/role/insert',
  SysUpdateRole = '/v1/admin/system/role/update',
  SysDeleteRole = '/v1/admin/system/role/delete',
}

const sysRoleList = async (data:APISYSTEMROLE.SysRoleParams) => requset<APISYSTEMROLE.SysRoleList>({ url: URL.SystemRole, method:"GET",  params: {...data} })

const sysFindRole = async (id:string) => requset({ url: URL.SysFindRole,method:"GET",  params: {id} })

const sysAddRole = async (data:APISYSTEMROLE.SysRoleAdd) => requset({ url: URL.SysAddRole, method:"POST", data:qs.stringify(data) })

const sysUpdateRole = async (data:APISYSTEMROLE.SysRoleUpdate) => requset({ url: URL.SysUpdateRole, method:"PUT", data:qs.stringify(data) })

const sysDeleteRole = async (id:string) => requset({ url: URL.SysDeleteRole, method:"DELETE", data: {id} })

export default { sysRoleList,sysFindRole,sysAddRole,sysUpdateRole,sysDeleteRole};
